﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Xml;

namespace Readify.Management.Automation.GoGrid
{
    public class GoGridImage
    {
        internal static GoGridImage CreateFromXmlNode(XmlNode objectElementNode)
        {
            GoGridImage output = new GoGridImage();
            output.ID = GoGridHelper.GetAttributeElementValueFromXmlNodeAsNullableInt32(objectElementNode, "id");
            output.Name = GoGridHelper.GetAttributeElementValueFromXmlNodeAsString(objectElementNode, "name");
            output.FriendlyName = GoGridHelper.GetAttributeElementValueFromXmlNodeAsString(objectElementNode, "friendlyName");
            output.Description = GoGridHelper.GetAttributeElementValueFromXmlNodeAsString(objectElementNode, "description");
            output.Location = GoGridHelper.GetAttributeElementValueFromXmlNodeAsString(objectElementNode, "location");
            output.IsActive = GoGridHelper.GetAttributeElementValueFromXmlNodeAsNullableBoolean(objectElementNode, "isActive");
            output.IsPublic = GoGridHelper.GetAttributeElementValueFromXmlNodeAsNullableBoolean(objectElementNode, "isPublic");
            output.CreatedTime = GoGridHelper.GetAttributeElementValueFromXmlNodeAsNullableDateTime(objectElementNode, "createdTime");
            output.UpdatedTime = GoGridHelper.GetAttributeElementValueFromXmlNodeAsNullableDateTime(objectElementNode, "updatedTime");

            return output;
        }

        public int? ID { get; set; }
        public string Name { get; set; }
        public string FriendlyName { get; set; }
        public string Description { get; set; }
        public string Location { get; set; }
        public bool? IsActive { get; set; }
        public bool? IsPublic { get; set; }
        public DateTime? CreatedTime { get; set; }
        public DateTime? UpdatedTime { get; set; }

        public override string ToString()
        {
            return this.Name;
        }
    }
}